#!/usr/bin/env python 
# _*_ coding: utf-8 _*_ 
import base64 
import urllib 
import httplib 
import commands

mt_appkey       = '1238fae55a587fd3eb22e240e422bc6e'

# data    = '{"isa":"MS2Transaction","mt_channel2":"CMMM_AXXXXXXXXXX","transaction_id":"52d90d393d1e19833e8b4567","coupon_code":"B3P4E2F8D5A5"}'
data    = '{"isa":"MS2Transaction","mt_channel2":"CMMM_AXXXXXXXXXX","transaction_id":"52ddd1933d1e19e5558b4568"}'
data    = commands.getoutput('/Project/hoono/bin/mtcrypto_mac -e -k ' + mt_appkey + " '" + data +"'")

headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
params  = urllib.urlencode({"mt_appkey": mt_appkey,"data": data})
conn    = httplib.HTTPConnection("m.morningtec.cn")

conn.request("POST","/hoono/yeepay/checktransaction/",params,headers)

response        = conn.getresponse() 
#print response.status 
print response.read().strip() 
